FusionCharts = function(fileName, id, width, height){
    /* constructor */
    var count = fileName.lastIndexOf('/')+1;
    this.type = fileName.substr(count,fileName.length-count).toLowerCase();  
    this.id = id;
    this.width = width;
    this.height = height;
};
FusionCharts.prototype = {
    constructor: FusionCharts,
    setDataXML: function(dataXML){
        this.dataJSON = xml2json.parser(dataXML.replace(/  /g," "));
        this.data = [];
        switch(this.type){
            case 'pie3d.swf':
                for(var i=0,j=this.dataJSON.chart.set.length;i<j;i++){
                    this.data[i] = [this.dataJSON.chart.set[i].label, this.dataJSON.chart.set[i].value];
                }
                break;
            default:
                for(var i=0,j=this.dataJSON.chart.set.length;i<j;i++){
                    this.data[i] = [this.dataJSON.chart.set[i].label, this.dataJSON.chart.set[i].value];
                }
                break;
        }
    },
    setTransparent: function(isTransparent){
    },
    render: function(parentNode){
        switch(this.type){
            case 'pie3d.swf':
                var Hchart = new Highcharts.Chart({
                    chart: {
                        renderTo: parentNode,
                        type: 'pie'
                    },
                    title: {
                        text: ''
                    },
                    tooltip: {
                        formatter: function() {
                            return '<b>'+ this.point.name +'</b>: '+ this.y;
                        }
                    },
                    plotOptions: {
                        pie: {
                            allowPointSelect: true,
                            cursor: 'pointer',
                            dataLabels: {
                                enabled: true,
                                color: '#000000',
                                connectorColor: '#000000',
                                formatter: function() {
                                    return '<b>'+ this.point.name +'</b>: '+ this.y;
                                }
                            },
                            showInLegend: true
                        }
                        
                    },
                    series: [{
                        type: 'pie',
                        data: this.data
                    }]
                });
                break;
            default:
                var Hchart = new Highcharts.Chart({
                    chart: {
                        renderTo: parentNode,
                        type: 'pie'
                    },
                    title: {
                        text: ''
                    },
                    tooltip: {
                        formatter: function() {
                            return '<b>'+ this.point.name +'</b>: '+ this.y;
                        }
                    },
                    plotOptions: {
                        pie: {
                            allowPointSelect: true,
                            cursor: 'pointer',
                            dataLabels: {
                                enabled: true,
                                color: '#000000',
                                connectorColor: '#000000',
                                formatter: function() {
                                    return '<b>'+ this.point.name +'</b>: '+ this.y;
                                }
                            },
                            showInLegend: true
                        }
                        
                    },
                    series: [{
                        type: 'pie',
                        data: this.data
                    }]
                });
                break;
        }
        return true;
    }
};

